/**
 * 
 */
package com.gxa.ssm251.service.impl;


import com.gxa.ssm251.mapper.GetVoMapper;
import com.gxa.ssm251.pojo.vo.GetVo;
import com.gxa.ssm251.service.GetVoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author bilei
 * @date 2021年3月31日
 */
@Component("getVoService")
public class GetVoServiceImpl implements GetVoService {

	// UserDao对象解决具体的持久化操作
	@Autowired
    GetVoMapper getVoMapper=null;
//	GetVoDao getVoDao =new GetVoDaoImpl();


//	@Override
//	public List<Cp> selectAllCp() throws Exception {
//		List<Cp> cpList=cpDao.selectAll();
//
//		return cpList;
//	}
	@Override
	public List<GetVo> selectAllByPage(Integer page, Integer size) throws Exception {
		List<GetVo> userList = getVoMapper.selectByPage(page, size);
		return userList;
	}

	@Override
	public List<GetVo> search(String nameOrphone, Integer page, Integer size) throws Exception {
		List<GetVo> userList = getVoMapper.searchNameOrPhone(nameOrphone,page, size);
		return userList;
	}

	@Override
	public boolean getCpn(Integer cpId, String phone) throws Exception {
		Integer cpn = getVoMapper.getCpn(cpId, phone);
		if (cpn>0){
			return true;
		}else {
			return  false;
		}
	}

//	@Override
//	public Integer insert(Cp cp) throws Exception {
//
//			Integer lines = cpDao.insert(cp);
//			return  lines;
//
//	}

//	@Override
//	public Integer update1(Integer id, Cp cp) throws Exception {
//		Cp selectedUser = cpDao.selectById(id);
//		if(selectedUser != null){
//			selectedUser.setName(cp.getName());
//			selectedUser.setDesc(cp.getDesc());
//			selectedUser.setImg(cp.getImg());
//			selectedUser.setRole(cp.getRole());
//			selectedUser.setColletExpire(cp.getColletExpire());
//			selectedUser.setUseExpire(cp.getUseExpire());
//			selectedUser.setInUse(cp.isInUse());
//		}
//		Integer update = cpDao.update1(id, selectedUser);
//		return update;
//	}
}
